package org.example;

import java.util.Scanner;

public class StudentView {
    /**
     * 程序开始
     */
    public void start(){
        StudentService ss = new StudentService();
        while(true) {
            System.out.println("-----------学生管理系统-----------");
            System.out.println("1 添加学生");
            System.out.println("2 修改学生");
            System.out.println("3 删除学生");
            System.out.println("4 查看学生");
            System.out.println("5 退出系统");
            System.out.println("请选择(1-5):");
            Scanner input = new Scanner(System.in);
            int num = input.nextInt();
            System.out.println("--------------------------------");

            switch (num) {
                case 1:
                    boolean b = ss.addStudent();
                    if(b){
                        System.out.println("添加成功！");
                    }
                    break;
                case 2:
                    break;
                case 3:
                    System.out.println("请录入要删除的学生编号:");
                    int stuNo = input.nextInt();
                    boolean delSuccess = ss.deleteStu(stuNo);
                    if(delSuccess){
                        System.out.println("删除成功！");
                    }else{
                        System.out.println("删除失败！");
                    }
                    break;
                case 4:
                    ss.showAll();
                    break;
                case 5:

                    break;
                default:
                    System.out.println("输入有误，请重新输入！");
            }
        }
    }
}
